﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace WowGuildSite.Armory
{
    public enum BaseStatType
    {
        Strength,
        Agility,
        Stamina,
        Intellect,
        Spirit,
        Armor,
    }

    public class ArmoryBaseStat
    {
        private int             baseValue;
        private int             effective;
        private BaseStatType    type;

        public int              Base
        {
            get { return baseValue; }
        }

        public int              Effective
        {
            get { return effective; }
        }

        public BaseStatType     Type
        {
            get { return type; }
        }

        internal static ArmoryBaseStat FromElement(XmlElement element)
        {
            if (element == null)
            {
                return new ArmoryBaseStat();
            }

            ArmoryBaseStat stat = new ArmoryBaseStat();
            stat.type = (BaseStatType)Enum.Parse(typeof(BaseStatType), element.Name, true);
            stat.effective = ArmoryXmlUtility.GetElementAttributeInt(element, "effective");
            stat.baseValue = ArmoryXmlUtility.GetElementAttributeInt(element, "base");

            return stat;
        }

        private ArmoryBaseStat()
        {
        }
    }
}
